{extend name='admin@public/content'}

{block name="button"}

<!--{if auth("$classuri/add")}-->
<button data-modal='{:url("$classuri/add")}' data-title="添加促销员" class='layui-btn layui-btn-sm'>添加促销员</button>
<!--{/if}-->

<!--{if auth("$classuri/del")}-->
<!--<button data-update data-field='delete' data-action='{:url("$classuri/del")}' class='layui-btn layui-btn-sm layui-btn-primary'>删除用户</button>-->
<!--{/if}-->
{/block}

{block name="content"}

<!-- 表单搜索 开始 -->
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get">


    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-inline">
            <input name="name" value="{$Think.get.name|default=''}" placeholder="请输入姓名" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-inline">
            <input name="mobile" value="{$Think.get.mobile|default=''}" placeholder="请输入手机号" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
     <label class="layui-form-label">报名状态</label>
     <div class="layui-input-inline">
         <select name="is_reg" class="layui-select">
             <option value="">所有</option>
             {foreach ['0'=>"未报名",'1'=>"已报名"] as $k=>$v}
             {if $Think.get.is_reg eq "$k"}
             <option selected="selected" value="{$k}">{$v}</option>
             {else}
             <option value="{$k}">{$v}</option>
             {/if}
             {/foreach}
         </select>
     </div>
 </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">经销商</label>
        <div class="layui-input-inline">
            <input name="jxs" value="{$Think.get.jxs}" placeholder="请输入经销商" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">商超系统</label>
        <div class="layui-input-inline">
            <input name="supermarket" value="{$Think.get.supermarket}" placeholder="请输入商超系统" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">门店</label>
        <div class="layui-input-inline">
            <input name="shop" value="{$Think.get.shop}" placeholder="请输入门店" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>

    <!--{if auth("$classuri/outItems")}-->
    <div class="layui-form-item layui-inline">
        <button type="button" class="layui-btn layui-btn-primary" lay-submit="" lay-filter="outOrders"><i class="layui-icon">&#xe601;</i> 导 出Excel</button>
    </div>
    <!--{/if}-->

</form>
<script>
    window.laydate.render({range: true, elem: '#range-date'});

    //监听提交
    form.on('submit(outOrders)', function(data){
        params = data.field;
        layer.confirm('确认要导出吗？',function(){
            loading = layer.load(2, {
                shade: [0.2,'#000']
            })
            var url = "{:url('admin/sales/outItems')}";
            DownLoad({ //调用下载方法
                url:url,data:params
            });
            layer.closeAll(); //关闭所有层

        });
    });

    /*通用下载导出*/
    function DownLoad(options) {
        var config = $.extend(true, { method: 'post' }, options);
        var $iframe = $('<iframe id="down-file-iframe" />');
        var $form = $('<form target="down-file-iframe" method="' + config.method + '" />');
        $form.attr('action', config.url);
        for (var key in config.data) {
            $form.append('<input type="hidden" name="' + key + '" value="' + config.data[key] + '" />');
        }
        $iframe.append($form);
        $(document.body).append($iframe);
        $form[0].submit();
        $iframe.remove();
    }
</script>
<!-- 表单搜索 结束 -->
<script>
    (function () {
        window.form.render();
        window.laydate.render({range: true, elem: '#create_at'});
    })();
</script>

<form onsubmit="return false;" data-auto="true" method="post">
    <!--{empty name='list'}-->
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    <!--{else}-->
    <input type="hidden" value="resort" name="action">
    <table class="layui-table" lay-skin="line">
        <thead>
        <tr>
            <th class='text-left nowrap'>ID</th>
            <th class='text-left nowrap'>经销商</th>
            <th class='text-left nowrap'>姓名</th>
            <th class='text-left nowrap'>手机号</th>
            <th class='text-left nowrap'>所在赛区</th>
            <th class='text-left nowrap'>门店</th>
            <th class='text-left nowrap'>报名状态</th>
            <th class='text-left nowrap'>操作</th>
        </tr>
        </thead>
        <tbody>
        <!--{foreach $list as $key=>$vo}-->
        <tr>
            <td class='text-left nowrap'>
                {$vo.sales_id}
            </td>
            <td class='text-left nowrap'>
                {$vo.jxs}
            </td>
            <td class='text-left nowrap'>
                {$vo.name}
            </td>
            <td class='text-left nowrap'>
                {$vo.mobile}
            </td>
            <td class='text-left nowrap'>
                {$vo.cate_name}
            </td>
            <td class='text-left nowrap'>
                {$vo.shop}
            </td>
            <td class='text-left nowrap'>
                {$vo.is_reg ?'已报名':'未报名'}
            </td>
            <td class='text-left nowrap'>
                <!--{if auth("$classuri/edit")}-->
                <span class="text-explode">|</span>
                <a data-modal='{:url("$classuri/edit")}?id={$vo.sales_id}'>编辑</a>
                <!--{/if}-->

                {if auth("$classuri/del")}
                <span class="text-explode">|</span>
                <a data-update="{$vo.sales_id}" data-field='delete' data-action='{:url("$classuri/del")}'>删除</a>
                {/if}

            </td>
        </tr>
        <!--{/foreach}-->
        </tbody>
    </table>
    {if isset($page)}<p>{$page|raw}</p>{/if}
    <!--{/empty}-->
</form>
<style>
    .headimg {
        width: 25px;
        height: 25px;
        border-radius: 50%;
        margin-right: 10px;
    }

</style>
{/block}